{smcl}
{hline}
help for {hi:rsens}
{hline}

{title:Sensitivity analysis after matching with multiple nearest neighbours}


{p 8 2 2}{cmdab:rsens}
{it:outcomevar}
{cmd:,}
    {cmdab:gamma}{cmd:(}{it:numlist}{cmd:)}
	{cmdab:nn}{cmd:(}{it:integer}{cmd:)}
    [{cmdab:treatment}{cmd:(}{it:varname}{cmd:)}
    {cmdab:id}{cmd:(}{it:varname}{cmd:)}
	{cmdab:matchid}{cmd:(}{it:namelist}{cmd:)}
  	{cmdab:support}{cmd:(}{it:varname}{cmd:)}]

{title:Description}

{pstd}
{cmd:rsens} calculates Rosenbaum sensitivity bounds following nearest neighbour matching with up to 20 nearest neighbours. While not mandatory, it is designed to be used after {help psmatch2}, as detailed below.
{p_end}

{pstd}
{cmd:rsens} implements the procedure described by Rosenbaum (2002) to calculate bounds on the significance level for the treatment effect calculated using nearest neighbour matching, based on a signed rank statistic.
{p_end}
   
{title: Basic Syntax}

(if used after {cmd:psmatch2})

{p 8 21 2}{cmdab:rsens}
{it:outcomevar}
{cmd:,}
    {cmdab:gamma}{cmd:(}{it:numlist}{cmd:)}
	{cmdab:nn}{cmd:(}{it:integer}{cmd:)}

{phang}
{it:outcomevar} is required, and specifies the variable name of the outcome for which treatment effects are being calculated.
{p_end}

{phang}
{cmdab:gamma}{cmd:(}{it:numlist}{cmd:)} is required, and specifies the values of Gamma at which Rosenbaum's
sensitivity bounds are to be calculated. {it: numlist} must contain 1, the level of Gamma at which allocation
to treatment is assumed to be independent of unobservables. 
{p_end}

{phang}
{cmdab:nn}{cmd:(}{it:integer}{cmd:)} is required, and specifies the number of nearest neighbours with which matching was undertaken. 
{p_end}


{title:Options}

{pstd}
{cmd:rsens} requires {it: outcomevar}, {cmdab:gamma}{cmd:(}{it:numlist}{cmd:)} and {cmdab:nn}{cmd:(}{it:integer}{cmd:)} to be specified if used after nearest neighbour matching undertaken with {cmd:psmatch2}. Otherwise, the following options might need to be specified. 
{p_end}

{p 8 21 2}{cmdab:rsens}
{it:outcomevar}
{cmd:,}
    {cmdab:gamma}{cmd:(}{it:numlist}{cmd:)}
	{cmdab:nn}{cmd:(}{it:integer}{cmd:)}
    {cmdab:treatment}{cmd:(}{it:varname}{cmd:)}
    {cmdab:id}{cmd:(}{it:varname}{cmd:)}
	{cmdab:matchid}{cmd:(}{it:varname}{cmd:)}	
	{cmdab:support}{cmd:(}{it:varname}{cmd:)}

Where

{phang}
{opt treatment(varname)} provides the binary indicator for allocation to treatment. The default {it:varname} generated by {cmd:psmatch2} is {inp:_treated}. 

{phang}
{opt id(varname)} provides the identifier used to specify matches. The default {it:varname} generated by {cmd:psmatch2} is {inp:_id}. 


{phang}
{opt matchid(namelist)} specifies, for each treatment observation, the prefix for a list of variable names of the form var1, var2, var3... that identify matched control observations according to {cmd:id}{cmd:(}{it:varname}{cmd:)}. For instance, matching on the nearest 3 neighbours and specifying {cmd:matchid}{cmd:(}{it: mymatch}{cmd:)} implies that the dataset should contain three variables mymatch1, mymatch2 and mymatch3 that identify, for each treatment observation, the matched control observations using {cmdab:id}{cmd:(}{it:varname}{cmd:)} as the identifier.  
The default {it:varname} generated by {cmd:psmatch2} is {inp:_n}, as in _n1, _n2, _n3 for nearest 3 neighbour matching. 

{phang}
{opt support(varname)} is an indicator variable that specifies the region of common support used in the matching exercise. The default {it:varname} generated by {cmd:psmatch2} is {inp:_support}.


{pstd}
The results of {cmd:rsens} are returned in r(rsensresult).


{title:Example}

{pstd}In the following, collgrad is the binary treatment and the outcome is wage. 

    {inp: . sysuse nlsw88.dta, clear}
    {inp: . psmatch2 collgrad age race married, outcome(wage) n(2)}
    {inp: . rsens wage, gamma(1(0.5)4) nn(2)}


{title:References}

Rosenbaum, P.R. (2002) Observational Studies. 2nd edition. New York: Springer.


{title:Author}

{pstd}
Sunil Mitra Kumar, King's College London; stuff.sunil@gmail.com



